package org.example.trainTicketSystem.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.*;
import org.example.trainTicketSystem.DTO.TicketDTO;

import java.math.BigDecimal;

@NoArgsConstructor
@Data
@TableName("ticket")
public class Ticket {

    @TableId(type = IdType.AUTO)
    private Integer ticketId;

    @TableField
    private Integer trainId;

    @TableField
    private String carriageNumber;

    @TableField
    private String seatNumber;

    @TableField
    private String seatType;

    @TableField
    private BigDecimal price;

    @TableField
    private String status;

    public Ticket(TicketDTO ticketDTO) {
      this.trainId = ticketDTO.getTrainId();
      this.carriageNumber = ticketDTO.getCarriageNumber();
      this.seatNumber = ticketDTO.getSeatNumber();
      this.seatType = ticketDTO.getSeatType();
      this.price = ticketDTO.getPrice();
      this.status = ticketDTO.getStatus();
    }
}
